Imports System.IO

Module ShowFolders

    Sub Main(args As String())
        Dim currentDir As String
    
        If args.Length>0 then
             currentDir =args(0)
        Else
             currentDir ="C:\"
       End If
        DisplayTree(currentDir)
    End Sub

    Sub DisplayTree(ByVal Dir As String)
        Dim Files As String() 
        Files= Directory.GetFiles(Dir)
        
        Dim Dirs As String() 
        Dirs= Directory.GetDirectories(Dir)
        Dim Filename As String
        For Each Filename In Files
            Console.WriteLine(Filename)
        Next

        Dim DirectoryName As String
        For Each DirectoryName In Dirs
            DisplayTree(DirectoryName)
        Next

    End Sub
End Module
